/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package elderberryni2.data.container;

import elderberryni2.abstracts.BaseTimestampable;
import elderberryni2.interfaces.IDumpable;

/**
 *
 * @author warringer
 */
public class AccelerationContainer extends BaseTimestampable<Float>
    implements Comparable<AccelerationContainer>, IDumpable {
    
    private float gravX, gravY, gravZ, gravVector;

    /**
     * 
     * @param gravX
     * @param gravY
     * @param gravZ
     * @param timestamp
     */
    public AccelerationContainer(float gravX, float gravY, float gravZ, float gravVector, float timestamp) {
        this.gravX = gravX;
        this.gravY = gravY;
        this.gravZ = gravZ;
        this.gravVector = gravVector;
        this.setTimestamp(timestamp);
    }

    /**
     * 
     * @return
     */
    public float getGravX() {
        return gravX;
    }

    /**
     * 
     * @return
     */
    public float getGravY() {
        return gravY;
    }

    /**
     * 
     * @return
     */
    public float getGravZ() {
        return gravZ;
    }

    /**
     * 
     * @return
     */
    public float getGravVector() {
        return gravVector;
    }

    @Override
    public Float getTimestampDifference(Float timestamp) {
        return Math.abs(this.getTimestamp() - timestamp);
    }

    /**
     * 
     * @param t
     * @return
     */
    @Override
    public int compareTo(AccelerationContainer t) {
        if (this.gravX == t.getGravX() && 
                this.gravY == t.getGravY() &&
                this.gravZ == t.getGravZ()) {
            return 0;
        } else {
            return 1;
        }
    }

    @Override
    public String toCSV() {
        return new Float(gravX).toString() 
                + ";" + new Float(gravY).toString() 
                + ";" + new Float(gravZ).toString() 
                + ";" + new Float(gravVector).toString();
    }
    
    @Override
    public String getHeader() {
        return "Acceleration X;Acceleration Y;Acceleration Z;Acceleration Vector";
    }
}
